package com.sh.apibackend.service;


import com.baomidou.mybatisplus.extension.service.IService;

import com.sh.apibackend.model.dto.user.UserRegisterRequest;
import com.sh.apibackend.model.vo.LoginUserVO;
import com.sh.apibackend.model.vo.QQToJMSMessage;
import com.sh.apibackend.model.vo.UserDevKeyVO;
import com.sh.apicommon.entity.User;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
 * 用户服务
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request, HttpServletResponse response);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);
    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request,HttpServletResponse response);


    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 重新生成密钥
     * @param request
     * @return
     */
    UserDevKeyVO regenerationKey(HttpServletRequest request);

    boolean userEmailRegister(UserRegisterRequest userRegisterRequest, String emailCaptcha);

    boolean sendToJMS(QQToJMSMessage qqToJMSMessage);
}
